<template>
	<view v-if="status==1">
		<scroll-view scroll-x class="bg-white nav">
			<view class="cu-item cu-item-style" :class="index==TabCur?'active cur':''" @tap="clickChange" :data-id="index" v-for=" (item,index) in tab" :key="index">{{item}}</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				TabCur:0,
				tab: ["全部","待付款","已付款","待评论"],
				open_id:'',
				articleList:[],
				status:3
			}
		},
		onLoad:function(options){
			let _this=this;
			// this.getBanner();
			uni.request({
				url: 'https://apiorder.wzq0307.com/api/Status/index',
				method: 'GET',
				data: {},
				success: (res) => {
					console.log(11111,res.data.data.status);
					_this.status=res.data.data.status;
						uni.setStorage('status',res.data.data.status);
				},
				fail: function(e) {
					console.log(JSON.stringify(e));
				}
			})
			console.log('订单页面的options',options.id);
			this.TabCur = options.id;
			// if (uni.getStorageSync('openid')) {
			// 	this.open_id = uni.getStorageSync('openid');
			// }
			// if (uni.getStorageSync('MyusrInfo')) {
			// 	if(options.id == 0){
			// 		this.getCollectArticle(this.open_id)
			// 	}else if(options.id == 2){
			// 		this.getPublishArticle(this.open_id)
			// 	}
			// }
		},
		methods:{
			clickChange:function(e){
				let index = e.currentTarget.dataset.id;
				this.TabCur = index
				// if (uni.getStorageSync('MyusrInfo')) {
				// 	if(index == 0){
				// 		this.getCollectArticle(this.open_id)
				// 	}else if(index == 1){
				// 		this.getLikeArticle(this.open_id)
				// 	}else if(index == 2){
				// 		this.getPublishArticle(this.open_id)
				// 	}
				// }
			}
		},
		filters: {
			formatTime: function(time) { //
				let date = new Date(time * 1000);
				let year = date.getFullYear();
				let month = (date.getMonth() + 1).toString().padStart(2, '0');
				let day = date.getDate().toString().padStart(2, '0');
				let hour = date.getHours().toString().padStart(2, '0');
				let minute = date.getMinutes().toString().padStart(2, '0');
				let second = date.getSeconds().toString().padStart(2, '0');
				return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
			}
		}
	}
</script>

<style>
	view,
	scroll-view,
	swiper,
	button,
	input,
	textarea,
	label,
	navigator,
	image {
		box-sizing: border-box;
	}
	.bg-white {
		background-color: #ffffff;
		color: #666666;
	}
	.nav.fixed {
		position: fixed;
		width: 100%;
		top: 0;
		z-index: 1024;
		box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1);
	}
	/* ==================
	         导航栏
	 ==================== */
	
	.nav {
		white-space: nowrap;
	}
	
	::-webkit-scrollbar {
		display: none;
	}
	
	.nav .cu-item {
		height: 90upx;
		display: inline-block;
		line-height: 90upx;
		margin: 0 10upx;
		padding: 0 20upx;
	}
	
	.nav .cu-item.cur {
		border-bottom: 4upx solid;
	}
	.cu-item-style {
		width: 22%;
		font-size: 14px;
		text-align: center;
	}

	.active {
		color: #d69c63;
		font-weight: 700;
	}
	.bg-white {
		background-color: var(--white);
		color: var(--darkGray);
	}
</style>
